Skip to main content

Create Payment Charge (Gateway)

POST /charges/gateway

Description​

Create a new payment charge via gateway.

Path Parameters​

NameTypeDescription
NoneNo parameters

Request Headers​

NameTypeDescription
countryCodestringThe country code (header)

Request Body​

  • Content Type: application/json
{
"tenantId": "string",
"productType": "CORAL_PAY",
"paymentMethod": "USSD",
"chargeFormula": "string",
"tenantChargeFormula": "string",
"type": "CREDIT"
}

Charge Formula Documentation​

  • Variables: A means amount, P means percentage
  • Constant: C means constant
  • Operators: * means multiplication, + means plus, - means minus
  • Comparators: < means less than, > means greater than
  • Delimiter: | means vertical pipe

Examples of possible Terms:

  • 5C
  • 4P*A
  • 5.6P*A
  • 4P*10C
  • 39C*A
  • 20C+A
  • 39C-A

Examples of charge formula and interpretation:

  • 4P*A means 4 percent of amount (A) or 4 percent multiplied by amount = 0.04*A
  • 5.6P*10C means 5.6 percent multiplied by constant (10) = 0.056*10 = 0.56

Response Code: 200 - OK​

Description​

Payment charge created successfully.

Response Fields​

FieldTypeDescription
statusbooleanIndicates if the operation was successful
statusCodeintegerStatus code
messagestringResponse message
dataobjectData related to the payment charge
errorsarrayList of error messages, if any

Example​

{
"status": true,
"statusCode": 0,
"message": "Payment charge created successfully",
"data": {},
"errors": [
{
"message": "Some error occurred",
"descriptiveMessage": "Detailed error message"
}
]
}

Method: POST​

>http://your-api-url/charges/gateway

Headers​

Content-TypeValue
apiKey{{apiKey}}
countryCodestring

Body​

{
"tenantId": "tenant123",
"productType": "CORAL_PAY",
"paymentMethod": "USSD",
"chargeFormula": "4P*A",
"tenantChargeFormula": "5.6P*10C",
"type": "CREDIT"
}

🔑 Authentication bearer​

ParamValueType
token{{accessCode}}string

LANGUAGE

AUTHORIZATION

Bearer

CURL REQUEST


curl --request POST \ 
--url /charges/gateway \
--header 'accept: application/json' \
--header 'content-type: application/json'

RESPONSE


Click Try It! to start a request and see the response here!